<%--
  @author Supun Nimesh Karunathilaka
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<script type="text/javascript">
    $(function () {
        // $('#landDetails').hide();
        $('#attachFile').hide();
        /*  $('a[rel*=facebox]').facebox(function() {
         $('#landDetails').show();
         });*/
    });

    function viewLandDetails() {
        var id = document.getElementById("landId").value;
        //ajax find land list by parent id
        var url = '${"findClildrenByParentLand.do?landId=' +id + '"}';
        $.get(url, $(this).serialize(), function (data) {
            $("#landDetails").html(data);
            //if list contain only one element display land details
            //else
            //display in tree
        });
    }

</script>

<style type="text/css">
    #landDetails {
        width: 800px;
    }
</style>

<div id="land-registration-module-home-title" class="module-home-title">
    <s:a href="searchModule.do"><img src="${pageContext.request.contextPath}/images/search.png"
                                     alt="Land Alienation"><span><s:label
            value="%{getText('search.label')}"/></span></s:a>
    <span class="module-title-breaker"> > </span>
    <s:a href="initViewAssociationList.do"><img
            src="${pageContext.request.contextPath}/images/searchLand.png"><span><s:label
            value="%{getText('search_lands_by_alienation.label')}"/></span></s:a>

    <div id="back-button" align="right">
        <s:form><s:submit value="%{getText('back_btn.label')}" action="initViewAssociationList"/></s:form>
    </div>
</div>

<div id="init-land-association">

    <s:if test="#session.userGroup=='lo' || #session.userGroup=='ords'">
        <h2><s:label value="Associated Lands with Alienation Methods Details"/></h2>
        <table>
            <tr>
                <td colspan="2" class="left-align">
                    <div class="action-msg"><s:actionmessage/></div>
                    <div class="action-err"><s:actionerror/></div>
                </td>
            </tr>
            <tr>
                <td class="left-align"><s:label value="%{getText('slmsSerialNumber.label')}"/> :</td>
                <%--<td class="left-align"><s:a href="#landDetails"><s:label name="land.id"/></s:a></td>--%>
                <td class="left-align"><a onclick="viewLandDetails();"><s:label name="land.id"/></a></td>
            </tr>
            <tr>
                <td class="left-align"><s:label value="Land Name"/> :</td>
                <td><s:property value="land.nameOfTheLand"/></td>
            </tr>
            <tr>
                <td class="left-align"><s:label value="Alienation Method"/> :</td>
                <td><s:property value="alienationMethodName"/></td>
            </tr>
            <tr>
                <td class="left-align"><s:label value="Purpose"/> :</td>
                <td><s:property value="landAssociation.purpose"/></td>
            </tr>
            <s:if test="landAssociation.comment!=null">
                <tr>
                    <td><s:label value="%{getText('comment.label')}"/> :</td>
                    <td><s:property value="landAssociation.comment"/></td>
                </tr>
            </s:if>
            <tr>
                <td><s:label value="%{getText('uploaded_documents.label')}"/> :</td>
            </tr>
            <s:include value="../../documentUpload.jsp"/>
        </table>
        <s:hidden name="land.id"/>
        <s:hidden name="landAssociation.id"/>
    </s:if>

</div>

<div id="landDetails">

</div>
<div>
    <s:include value="../../landTree.jsp"/>
</div>
<s:hidden id="landId" name="land.id"/>

<%--<div id="landDetails">
    <s:include value="landDetails.jsp"/>
</div>--%>
